package cn.crex1.springboot.pojo;

import java.util.List;
import java.util.Map;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

/**  
* <p>title: User</p>  
* <p>description: </p>  
* @author zzh  
* @date 2018年7月18日  
*/
//将当前类作为组件加入spring容器中
@Component
//属性值批量注入 
@ConfigurationProperties(prefix="user")
//验证属性
@Validated
public class User {
	
	@NotNull
	private Integer id;
	
	@Valid
	private String username;
	
	private Integer sex;
	
	private Integer age;
	
	private List<String> animals;
	
	private Map<String, Object> pet;
	
	private List<Map<String, Object>> childs;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public List<String> getAnimals() {
		return animals;
	}

	public void setAnimals(List<String> animals) {
		this.animals = animals;
	}

	public Map<String, Object> getPet() {
		return pet;
	}

	public void setPet(Map<String, Object> pet) {
		this.pet = pet;
	}

	public List<Map<String, Object>> getChilds() {
		return childs;
	}

	public void setChilds(List<Map<String, Object>> childs) {
		this.childs = childs;
	}
	
	@Override
	public String toString() {
		return "User [id=" + id + ", username=" + username + ", sex=" + sex + ", age=" + age + ", animals=" + animals
				+ ", pet=" + pet + ", childs=" + childs + "]";
	}
}
